<template>
  <div style="height: 600px; overflow-y: auto;">
    <div>
      <el-divider></el-divider>
      <div>
        <el-form ref="form" :model="form" label-suffix="：" label-width="100px">
          <el-form-item label="党组织名称">
            <el-input v-model="form.showName"></el-input>
          </el-form-item>
          <el-form-item label="上级组织">
            <el-input v-model="form.parentId"></el-input>
          </el-form-item>
          <el-form-item label="组织简介">
            <el-input type="textarea"
                      v-model="form.detailed"
                      :rows="5">
            </el-input>
          </el-form-item>
        </el-form>
      </div>
      <el-divider></el-divider>
      <div>
        <div v-for="(item,key) in userList" style="float: left; margin-right: 10px;">
          <el-card shadow="hover" style="width: 350px;">
            <div slot="header">
              <span>人员信息</span>
              <el-button style="float: right; padding: 3px 0" type="text">修改</el-button>
            </div>
            <div>
              <el-form ref="form" :model="form" label-suffix="：" label-width="120px" size="mini">
                <el-form-item label="组织领导姓名">
                  <el-input v-model="item.realName"></el-input>
                </el-form-item>
                <el-form-item label="登录密码">
                  <el-input v-model="item.loginPwd" show-password readonly></el-input>
                </el-form-item>
                <el-form-item label="组织领导职务">
                  <el-input v-model="item.showName"></el-input>
                </el-form-item>
              </el-form>
            </div>
          </el-card>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    name: '',
    components: {

    },
    data () {
      return {
        form: {
          showName: '',
          parentId: '',
          detailed: '',
        },
        testNode : this.pNode,
        userList:[],
      }
    },
    created(){

    },
    props:["pNode"],
    watch:{
      pNode:function(newData,oldData){
        this.form.testNode = newData;
        this.form.showName = newData.showName;
        this.form.parentId = newData.parentId;
        this.form.detailed = newData.detailed;
        this.getUserByDeptId();
      }
    },
    methods: {
      getUserByDeptId(){
        console.log(this.pNode);
        console.log(this.pNode.sid);
        this.$http({
          url: this.$BASE_URL+'api/user/findUserByDeptId?params='+this.pNode.sid,
          headers:{
            token:sessionStorage.getItem("token")
          }
        }).then((res)=>{
          if(res.data.code == 200){
            this.userList = res.data.output;
            console.log(this.userList);
          }
        },(res)=>{
          this.$notify.error({
            title: '错误',
            message: "服务器连接故障！",
            duration: 5000
          });
          console.log(res);
        });
      }
    },
  }
</script>
<style scoped>

</style>
